package com.fastjars.business.spring.fastjson.filter;

import com.alibaba.fastjson.serializer.ValueFilter;

/**
 * AbsValue
 * 仅支持单个属性值
 * @author Brant Liu <br>
 * 邮箱：lbf1988@qq.com <br>
 * 日期：2018/5/4
 * @version 1.0.0
 */
public abstract class AbsValue extends AbsBase implements ValueFilter {
    public abstract String setFieldName();

    public abstract Object setValue(Object propertyValue);

    @Override
    public Object process(Object object, String propertyName, Object propertyValue) {
        if(checkObject(object)) {
            if (propertyName.equals(setFieldName())) {
                return setValue(propertyValue);
            }
        }
        return propertyValue;
    }
}
